package com.longrise.android.byjk.plugins.hra.hratabfirst.hradetailweb;

import android.graphics.PixelFormat;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.webkit.WebSettings;
import android.webkit.WebView;

import com.longrise.android.byjk.R;
import com.longrise.android.byjk.utils.GetWebUrlHelper;
import com.longrise.common.base.web.BaseWebActivity;
import com.longrise.common.base.web.BaseWebBridge;
import com.longrise.common.base.web.BaseWebClient;

/**
 * Created by callxkj on 2018/1/29.
 * hra 头部banner 点击跳转到此页面
 */

public class HraDetailWebActivity extends BaseWebActivity {
    private WebView mWv;

    @Override
    public int getContentViewId(@Nullable Bundle savedInstanceState) {
        return R.layout.app_web_comment;
    }

    @Override
    public WebView getWebView() {
        return mWv;
    }

    @Override
    public void init() {
        getWindow().setFormat(PixelFormat.TRANSLUCENT);
        mWv = (WebView) findViewById(R.id.comment_wv);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            mWv.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
        }
    }

    @Override
    public void initData() {
        GetWebUrlHelper.getWebUrl(GetWebUrlHelper.HRA, new GetWebUrlHelper.OnGetWebUrlResultListener() {
            @Override
            public void onSuccess(String url) {
                loadUrl(url);
            }

            @Override
            public void onError(String errormsg) {
                showToast(errormsg);
            }
        });
    }

    @Override
    public BaseWebBridge getwebBridge() {
        return null;
    }

    @Override
    public BaseWebClient getWebClient() {
        return new HraDetailWebClient(this);
    }


}
